<html>
<head>
	<title>用户登录</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<script language="javascript" src="/static/js/jquery-3.5.1.min.js"></script>
	<script language="javascript" src="/static/js/import.js"></script>
	<style>
		html,
		body {
			height: 100%;
		}
		body {
			display: flex;
			align-items: center;
			padding-top: 40px;
			padding-bottom: 40px;
			background-color: #f5f5f5;
		}
	</style>
	<script language="javascript">
		$(function(){
			$("#loginForm").ajaxForm({
				url: "/springmvc-demo/login.do",
				type: "post",
				success: function(result){
					if(result.code == 200){
						localStorage.setItem("user",JSON.stringify(result.data));
						window.top.location.href = "/springmvc-demo/main.htmlx";
					}else {
						Message.danger(result.msg);
					}
				}
			});
		});
	</script>
</head>
<body>
<div class="container" style="width: 330px">
	<h4>登录页面</h4>
	<form id="loginForm">
		<input type="text" id="username" name="username" class="form-control" placeholder="用户名" required autofocus>
		<p class="error"></p>
		<input type="password" id="password" name="password" class="form-control" placeholder="密码" required>
		<p class="error"></p>
		<button class="btn btn-primary" type="submit">登录</button>
	</form>
</div>
</body>
</html>
